<template>
  <div>
    <div class="padding-class">
      <el-card style="height: 80px">
        <el-button style="float: right;" type="primary" @click="updateSchool">保存</el-button>
      </el-card>
    </div>
    <div class="padding-class">
      <tinymce v-model="introduction"></tinymce>
    </div>
  </div>
</template>

<script>
  import Tinymce from '../../../components/Tinymce/index'

  import {uploadFile} from "../../../api/file";
  import {getIntroduction, updateIntroduction} from '../../../api/school'

  export default {
    name: "school",
    components: {Tinymce},
    data() {
      return {
        introduction: ''
      }
    },
    created() {
      this.getSchool()
    },
    methods: {
      getSchool() {
        getIntroduction().then(res => {
          this.introduction = res.data.schoolIntroduction
        }).catch(err => {
          this.$message.error('请求失败！')
        })
      },
      updateSchool(){
        updateIntroduction({
          schoolIntroduction: this.introduction,
          siid: '1'
        }).then(res => {
          this.$message.success('修改成功！')
          this.getSchool()
          }).catch(err => {
          this.$message.error('修改失败！')

          })
      }


    }
  }
</script>

<style scoped>
  .padding-class {
    padding: 20px;
  }
</style>
